package com.asohofrucol.dto.util;

import java.util.List;

import com.asohofrucol.dto.ParameterDTO;
import com.asohofrucol.dto.ParameterSiteDTO;
import com.asohofrucol.model.ColDepartament;
import com.asohofrucol.model.ColMunicipality;
import com.asohofrucol.model.ColVillage;
import com.asohofrucol.model.Option;

public class ParameterHelperDto {

	public static ParameterDTO convertToParameterDTO(List<Option> options) {
		ParameterDTO parameterDTO = new ParameterDTO();
		for (Option option : options) {// por que esta al contrariollave valor?
			parameterDTO.getOptions().put(option.getDescription(),
					option.getId());
			//System.out.println("Descripcion = "+option.getDescription()+" "+option.getId());
		}
		return parameterDTO;
	}

	public static ParameterSiteDTO convertColDepartamentToParameterSiteDTO(
			List<ColDepartament> colDeps) {
		ParameterSiteDTO parameterSiteDTO = new ParameterSiteDTO();
		for (ColDepartament colDep : colDeps) {
			parameterSiteDTO.getOptions().put(colDep.getNamDepartament(),
					colDep.getCodDepartament());
		}
		return parameterSiteDTO;
	}

	public static ParameterSiteDTO convertColMunicipalityToParameterSiteDTO(
			List<ColMunicipality> colMuns) {
		ParameterSiteDTO parameterSiteDTO = new ParameterSiteDTO();
		for (ColMunicipality colMun : colMuns) {
			parameterSiteDTO.getOptions().put(colMun.getNamMunicipality(),
					colMun.getCodMunicipality());
		}
		return parameterSiteDTO;
	}

	public static ParameterSiteDTO convertColVillageToParameterSiteDTO(
			List<ColVillage> colVills) {
		ParameterSiteDTO parameterSiteDTO = new ParameterSiteDTO();
		for (ColVillage colVill : colVills) {
			parameterSiteDTO.getOptions().put(colVill.getNamVillage(),
					colVill.getCodVillage());
		}
		return parameterSiteDTO;
	}
}
